<?php

namespace app\models;

use Yii;

/**
 * This is the model class for table "gky_jiaogai_lunwen".
 *
 * @property integer $id
 * @property string $name
 * @property string $xibie
 * @property string $sex
 * @property string $birthday
 * @property string $xueli
 * @property string $xuewei
 * @property string $biye
 * @property string $zhuanye
 * @property string $zhicheng
 * @property string $zhicheng_time
 * @property string $zhengshu
 * @property string $zhengshu_time
 * @property string $lunwen_name
 * @property string $kanwu
 * @property string $fabiao_time
 * @property string $hexin
 * @property string $beizhu
 */
class GkyJiaogaiLunwen extends \yii\db\ActiveRecord
{
    /**
     * @inheritdoc
     */
    public static function tableName()
    {
        return 'gky_jiaogai_lunwen';
    }

    /**
     * @inheritdoc
     */
    public function rules()
    {
        return [
            [['birthday', 'biye', 'zhicheng_time', 'zhengshu_time', 'fabiao_time'], 'safe'],
            [['name', 'xibie', 'sex', 'xueli', 'xuewei', 'zhuanye', 'zhicheng', 'zhengshu', 'lunwen_name', 'kanwu', 'hexin', 'beizhu'], 'string', 'max' => 255],
        ];
    }

    /**
     * @inheritdoc
     */
    public function attributeLabels()
    {
        return [
            'id' => 'ID',
            'name' => 'Name',
            'xibie' => 'Xibie',
            'sex' => 'Sex',
            'birthday' => 'Birthday',
            'xueli' => 'Xueli',
            'xuewei' => 'Xuewei',
            'biye' => 'Biye',
            'zhuanye' => 'Zhuanye',
            'zhicheng' => 'Zhicheng',
            'zhicheng_time' => 'Zhicheng Time',
            'zhengshu' => 'Zhengshu',
            'zhengshu_time' => 'Zhengshu Time',
            'lunwen_name' => 'Lunwen Name',
            'kanwu' => 'Kanwu',
            'fabiao_time' => 'Fabiao Time',
            'hexin' => 'Hexin',
            'beizhu' => 'Beizhu',
        ];
    }
       public static function jiaogailunwen($pageNow, $pageSize){
       $list = GkyJiaogaiLunwen::find()
            ->addSelect(['id','lunwen_name','name','fabiao_time'])
            ->addOrderBy(['fabiao_time' => SORT_DESC])
            ->offset(($pageNow - 1) * $pageSize)
            ->limit($pageSize)
            ->all();
        return $list;
    }
}
